package com.fg.fgmall.controller;

import com.fg.fgmall.common.R;
import com.fg.fgmall.entity.Banner;
import com.fg.fgmall.service.BannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class BannerController {

    @Autowired
    private BannerService bannerService;

    @GetMapping("/banners")
    public R selectAllBanner() {

        try {
            List<Banner> banners = bannerService.selectAllBanner();
            return R.ok(banners);
        } catch (Exception e) {
            return R.error();
        }
    }
}
